﻿using UnityEngine;

namespace UIFramework
{
    public static class ColorExtend
    {
        public static string ToRGBA(this Color c)
        {
            return $"#{ColorUtility.ToHtmlStringRGBA(c)}";
        }

        public static string ToRGB(this Color c)
        {
            return $"#{ColorUtility.ToHtmlStringRGB(c)}";
        }

        public static Color ToColor(this string Self)
        {
            if (ColorUtility.TryParseHtmlString(Self, out Color color)) return color;
            return Color.white;
        }
    }
}

